//
//  BBAction.m
//  BBGameLib
//
//  Created by Eric on 12/23/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "BBAction.h"


#pragma mark Remove Action
@implementation BBActionRemove

+(id)action {
	return [[[self alloc] init] autorelease];
}

-(void) startWithTarget:(id)aTarget
{
	[super startWithTarget:aTarget];
	[aTarget removeFromParentAndCleanup:YES];
}

@end




@implementation BBMoveTo
@synthesize speed=_speed;
+(id)actionWithSpeed:(CGFloat)speed from:(CGPoint)from to:(CGPoint)to{
    CGFloat d = sqrtf(powf((to.x - from.x), 2) + powf((to.y - from.y), 2));
    ccTime t = d/speed;
    
    BBMoveTo* action = [[self class] actionWithDuration:t position:to];
    action.speed = speed;
    return action;
}
@end
